package work4;

public class AA extends Thread {
    private final PrintA printA;

    public AA(PrintA printer) {
        this.printA = printer;
    }

    @Override
    public void run() {
        while (printA.letter <= 'Z') {
            synchronized (printA.lock) {
                while (printA.isNumberTurn) {
                    try {
                        printA.lock.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                System.out.print(printA.letter++);
                printA.isNumberTurn = true;
                printA.lock.notifyAll();
            }
        }
    }
}

